﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

namespace VisionCloud.Core.Migrations
{
    public partial class AddIndex : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "SysDeviceUser",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    CreatedBy = table.Column<Guid>(type: "uuid", nullable: false),
                    CreatedDate = table.Column<DateTime>(type: "timestamp(0)", nullable: false),
                    DeviceGuid = table.Column<Guid>(nullable: false),
                    UserGuid = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SysDeviceUser", x => x.Id);
                });

            migrationBuilder.CreateIndex(
                name: "IX_SysDeviceUser_DeviceGuid",
                table: "SysDeviceUser",
                column: "DeviceGuid");

            migrationBuilder.CreateIndex(
                name: "IX_SysDeviceUser_UserGuid",
                table: "SysDeviceUser",
                column: "UserGuid");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "SysDeviceUser");
        }
    }
}
